package tuilayer;
import controllayer.PersonCtrl;
import java.util.Scanner;


/**
 * Write a description of class LoginUI here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 **/
public class LoginUI
{/*
    private MainUI mainUI;
    private PersonCtrl personCtrl;
    
    public static void main(String[] args)
    {
    	new LoginUI();
    }
    
    public LoginUI()
    {
        personCtrl = new PersonCtrl();
        loginMenu();
    }
    
    public void loginMenu()
    {
        boolean exit = false;
        while (!exit) //means while exit is not true (that is: false)
        {
            int choice = writeLoginMenu();
            switch (choice)
            {
                case 1:
                    login();
                    break;
                    
                case 2:
                    //addClerk();
                    break;
                    
                case 3:
                    //listAllClerks();
                    break;
                    
                case 4:
                    //updateClerk();
                    break;
                    
                case 5:
                    //deleteClerk();
                    break;
                    
                case 0:
                    writeExitMessage();
                    exit = true;
                    break;
                    
                default:
                    writeDefaultMessage();
                    break;
            }
        }
    }
    
    private int writeLoginMenu()
    {
        Scanner scanner = new Scanner(System.in);
        System.out.println("\f *** LOG-IN MENU ***");
        System.out.println("(1) Log ind.");
        System.out.println("(2) Opret en bruger.");
        System.out.println("(3) Se alle brugere.");
        System.out.println("(4) Opdater brugeroplysninger.");
        System.out.println("(5) Slet en bruger.");
        System.out.println("(0) Afslut programmet.");
        
        int choice = scanner.nextInt();
        
        return choice;
    }
    
    private void login()
    {
        int clerkNo = inputClerkNo();
        
        if (personCtrl.getClerk(clerkNo) != null)
        {
            System.out.println("Du er logget ind som "+personCtrl.getClerkFullname(clerkNo));
            this.waitInput();
            mainUI = new MainUI(clerkNo);
            mainUI.mainMenu();
        }
        else
        {
            System.out.println("Forkert medarb.nr. - prøv igen.");
            waitInput();
        }
    }
    
    /*private void addClerk()
    {
        //int sizeOne = personCtrl.clerkListSize();
        
        String firstName = inputFirstName();
        String lastName = inputLastName();
        String addressStreet = inputAddressStreet();
        String addressCity = inputAddressCity();
        String addressZipcode = inputAddressZipcode();
        
        personCtrl.addClerk(firstName, lastName, addressStreet, addressCity, addressZipcode);
        
        //int sizeTwo = personCtrl.clerkListSize();
        
        if (sizeOne < sizeTwo)
        {
            System.out.println("Brugeren er oprettet.");
        }
        else
        {
            System.out.println("Brugeren blev ikke oprettet. Prøv venligst igen.");
        }
        
        waitInput();
    }*/
    
    /*private void listAllClerks()
    {
        personCtrl.listAllClerks();
        waitInput();
    }*/
    
    /*private void updateClerk()
    {
        int clerkNo = inputClerkNo();
        String firstName = inputFirstName();
        String lastName = inputLastName();
        String addressStreet = inputAddressStreet();
        String addressCity = inputAddressCity();
        String addressZipcode = inputAddressZipcode();
        
        personCtrl.updateClerk(clerkNo, firstName, lastName, addressStreet, addressCity, addressZipcode);
        
        System.out.println("Brugeroplysningerne er opdaterede.");
        
        waitInput();
    }*/
    
    /*private void deleteClerk()
    {
        int clerkNo = inputClerkNo();
        int sizeOne = personCtrl.clerkListSize();
        
        personCtrl.deleteClerk(clerkNo);
        
        int sizeTwo = personCtrl.clerkListSize();
        
        if (sizeOne > sizeTwo)
        {
            System.out.println("Brugeren er slettet.");
        }
        else
        {
            System.out.println("Brugeren blev ikke slettet. Prøv venligst igen.");
        }
        
        waitInput();
    }*
    
    private int inputClerkNo()
    {
         Scanner keyboard = new Scanner(System.in);  
         System.out.println("Indtast medarb.nr.: ");
         int clerkNo = keyboard.nextInt();
         return clerkNo;
    }
    
    private String inputFirstName()
    {
         Scanner keyboard = new Scanner(System.in);  
         System.out.println("Indtast fornavn: ");
         String firstName = keyboard.nextLine();
         return firstName;
    }
    
    private String inputLastName()
    {
         Scanner keyboard = new Scanner(System.in);  
         System.out.println("Indtast efternavn: ");
         String lastName = keyboard.nextLine();
         return lastName;
    }
    
    private String inputAddressStreet()
    {
         Scanner keyboard = new Scanner(System.in);  
         System.out.println("Indtast addresse (vej + nr.): ");
         String addressStreet = keyboard.nextLine();
         return addressStreet;
    }
    
    private String inputAddressCity()
    {
         Scanner keyboard = new Scanner(System.in);  
         System.out.println("Indtast by: ");
         String addressCity = keyboard.nextLine();
         return addressCity;
    }
    
    private String inputAddressZipcode()
    {
         Scanner keyboard = new Scanner(System.in);  
         System.out.println("Indtast postnr.: ");
         String addressZipcode = keyboard.nextLine();
         return addressZipcode;
    }
    
    private void writeExitMessage()
    {
        System.out.println("Programmet er afsluttet. Fortsat god dag!");
    }
    
    private void writeDefaultMessage()
    {
        System.out.println("Forkert kommando - prøv igen.");
    }
    
    private void waitInput()
    {
        System.out.println("Tryk ENTER for at fortsætte...");
        new Scanner(System.in).nextLine();
    }
}*/
} 